﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05继承
{
    /// <summary>
    /// 基类-武器类
    /// </summary>
    class Weapon
    {
        //字段
        protected string _name;//武器名称
        protected int _magazineCapacity;//弹匣容量
        protected int _ammoNumInMc;//当前弹匣中的弹药数量
        protected float _attackRange;//攻击范围
        protected float _fireRate;//射速

        

        public Weapon(string name, int mc, int an, float dis)
        {
            _name = name;
            _magazineCapacity = mc;
            _ammoNumInMc = an;
            _attackRange = dis;
            //Console.WriteLine("父类有参数构造函数被调用");
        }
        //虚方法
        //希望子类重写本方法，但不强制
        public virtual void Fire()
        {
            Console.WriteLine("基类开火方法");
        }
    }
}
